<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改元素属性</title>
    <style>
        div{
            width:200px;
            height:200px;
            background-color: cadetblue;
            margin-bottom: 10px;
        }
        button{
            margin-left: 10px;
        }
        .change-border{
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <div class="change"></div>
    <button class="btn">变回圆形</button>
    <button class="btn">变回方形</button>
    <script>
        var box =document.getElementsByClassName('change');
        var btns =document.getElementsByClassName('btn');
        btns[0].onclick=function(){
            box[0].classList.add('change-border')
        };
        btns[1].onclick=function(){
            box[0].classList.remove('change-border')
        };
    </script>
</body>
</html>